-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing language selection #212
base: main
Are you sure you want to change the base?
Conversation
Create a new branch based on current code "rc" (as of 20200429).
Update files for language selection support
added "settings" messages
added localized string handling of "locale selection" form's elements
modified function to handle i18n localization
added style for "select language" form elements
Update for language selection
I thought that it could be a good idea to add a "refresh this page" button in the appearance tab, at the top in the unnamed section. But when reloading, the focus moves to the welcome tab. I've looked at the code, and found that it is possible to load a specific tab. If only selecting a tab also updates the I've tested with my own code, and the Do I add the code to update the location.hash in this PR? |
@Procyon-b Sorry for the long delay in responding! For "refresh this page" / location.href, please include that in a separate PR if you would like to submit the code. I would like to keep this PR focused on the language support. Thanks! |
It is base the code released to version 0.2.1.
Those who might read this can download and test without fearing any (new) problems outside the added localization code.
Here is a list of modifications so far:
manifest.js
to support localization:future_i18n()
tries to get localized string from_T()
manifest.js
now callfuture_i18n()
with 1 or more optional parameters: second arg is the name of the message, and other args are placeholders (used a couple times).future_i18n()
is still compatible with old usage to support messages not yet localized.setting_definitions
).__custom.css
contains style to move the button next to the select (float) and to hide these elements.code in
setting.js
adds CSS classes to these elements (CSS classes can't be added by editingsetting_definitions
), and defines event-based functions to handle user actions (using CSS classes).To get a full overview, select the french locale and reload the settings page.
Users who would like to translate the settings page in their language can base it on the FR locale file. Unfortunately I have not yet added the "description" element to the new messages, But they are defined in the order of appearance in the page, and their name is a hint of what they do.
Edit your locale in a text editor and paste it regularly in the form element for "user-defined" locale. Refresh the page. If you make syntax errors (unescaped quotes in messages, error in JSON syntax), the locale will be ignored and the english locale is selected.
Also, if the user-locale is incomplete, it is completed with messages from the english locale.